<template>
  <div>
    <div>
      <el-table :data="teamData" style="width: 100%" height="770px">
        <el-table-column prop="namee" label="姓名" width="180"></el-table-column>
        <el-table-column prop="phone" label="联系方式"></el-table-column>
        <el-table-column prop="introduce" label="简介"></el-table-column>
        <el-table-column label="简历">
          <template slot-scope="scope">
            <a  :href=scope.row.doc>点击查看文档</a>
          </template>
        </el-table-column>

        <!--<el-table-column prop="wid" label="工作室号 "width="180"></el-table-column>-->
        <!--<el-table-column prop="projectName" label="工作室名" width="180"></el-table-column>-->
        <!--<el-table-column prop="price" label="报价"></el-table-column>-->
        <!--<el-table-column prop="timeLimit" label="工期"></el-table-column>-->
        <el-table-column label="操作">
          <template slot-scope="scope">

            <el-button v-if="scope.row.states===2"
                       size="mini"
                       type="danger"
                       @click="handleDelete(scope.$index, scope.row)">联系工作室</el-button>
            <el-button v-if="scope.row.states===0"
              size="mini"
              @click="handleEditt(scope.$index, scope.row)">同意</el-button>
            <el-button v-if="scope.row.states===0"
              size="mini"
              type="danger"
              @click="handleDelete(scope.$index, scope.row)">拒绝</el-button>
          </template>
        </el-table-column>
      </el-table>

    </div>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        tid:'',
        tableData: [
          {
            gid:'',
            id:'',
            wid:'',
            projectName:'',
            price:'',
            timeLimit:''
          }
        ],
        teamData:[]
      }
    },
    mounted: function(){

      this.tid = this.$route.query.mallCode


      axios.post('/user/findApplyJob',{
        id: this.tid,
        eid: this.tid
      }).then((response) => {
        if(response.data!=""){





          var ee=response.data
          this.teamData=ee




        }
        else{
          // this.$notify.error({
          //   title: '没有人申请该项目',
          //   message: response.data.message,
          //   type: 'warning',
          //   duration:0
          // });
        }

      }).catch((response)=>{
        this.$notify.error({
          title: '',
          message: '错误'
        });
      })


    },
    methods: {
      handleEdit(index, row) {

        this.$router.push({
          path: '/Workroom',
          query: {
            mallCode:row.wid,
          }
        })
      },

      handleEditt(index, row) {
        console.log(row.wid)
        var ee=row.wid
        axios.post('/user/upApplyJobStates',{
          id : row.id,
          states : 2
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });

            location.reload()
          } else{
            this.$notify({
              title: '失败',
              message: '操作失败',
              type: 'warning',
              duration:2000
            });
          }
        })


      },
      handleDelete(index, row) {

        var ff=row.id
        var a="1"
        console.log(ff)
        console.log(a)
        axios.post('/user/upApplyJobStates',{
          id : row.id,
          states : 1
        }).then((response) => {
          if( response.data.states== 800){
            this.$notify({
              title: '成功',
              message: '成功',
              type: 'success',
              duration:2000
            });
            location.reload()
          }
          else{
            this.$notify({
              title: '失败',
              message: '操作错误',
              type: 'warning',
              duration:2000
            });
          }
        })


      }

    }}
</script>

<style scoped>

</style>

